#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const int N=2e5+10;
#define INF 0x3f3f3f3f;
typedef long long int ll;
#define close(); std::ios::sync_with_stdio(false);cin.tie(0),cout.tie(0);
//----------------------------------------------------------------------------//
int n,k,x;
void solve()
{
	cin>>n>>k;
	vector<int> a,b;//a大于 b小于 c等于
	int zo=0;
	ll ans=0;
	for(int i=0;i<n;i++)
	{
		cin>>x;
		if(x>0) a.push_back(x);
		if(x==0) zo++;
		if(x<0) b.push_back(x);
	}
	sort(all(a));
	sort(b.begin(),b.end(),greater<int>());

	ll sum=0;
	int sz_a=a.size(),sz_b=b.size();

	ll num_a=-INF;ll num_b=-INF;
	for(int i=sz_a-1,j=sz_b-1;k>0&&(i>0||j>0);k--)
	{
		if(i>0) num_a=a[i]*a[i-1];
		if(j>0) num_b=b[j]*b[j-1];
		if(num_a>num_b)
		{
			ans+=num_a;
			i-=2;
			num_a=-INF;
		}
		else
		{
			ans+=num_b;
			j-=2;
			num_b=-INF;
		}
	}
	if(k>0)
	{
		if(k==1)
		{
			if(zo==0) ans+=a[0]*b[0];
		}
	}
	cout<<ans<<'\n';


	
}

int main()
{
	close();
	int T=1;
	while (T--) solve();
	return 0;
}